/*
 * {文档加载完成执行}
 */
$(document).ready(function(){
	bindEvent();
});

/**
 * 事件绑定
 */
function bindEvent(){
    $("#query").bind("click", doQuery11);
    changeCode();
} 

function doQuery11(){
	var code = $('#code').val();
	var captcha = $('#captcha').val();
	$.ajax({
		   type: "POST",
		   async: false,//同步发送请求数据
		   //url : appPath+'/menu?method=addOrEditMenu',		
		   url: appPath+"/drug?method=queryDrug",
		   data: "code=" + code + "&captcha=" + captcha,
		   beforeSend : function(){
			   $('#resultMSG').html('loading');
		   },
		   complete : function(){
			   //$('#resultMSG').html('');
		   },
		   timeout:120*1000,
		   dataType:"text",
	       success: function(data){
	    	   if(data){
	    		   $("#resultMSG").html(data);
	    	   }
	    	   changeCode();
		   },
		   error:function(xhr,textStatus,errorThrown){
			   alert(textStatus)
		   }
		});
}

function changeCode(){
	$("#captchaImage").attr("src","http://sp.drugadmin.com/showValidateCode?"+Math.random());
	$("#captcha").val("");
}

